<template>
  <page-header-wrapper :title="false">
    <a-card>
      <div class="table-page-search-wrapper">
        <a-form layout="inline">
          <a-row :gutter="48">
            <a-col :md="6" :sm="24">
              <a-form-item label="筛选">
                <a-input v-model="value" placeholder="请输入" />
              </a-form-item>
            </a-col>
            <a-col :md="(!advanced && 8) || 24" :sm="24">
              <span
                class="table-page-search-submitButtons"
                :style="(advanced && { float: 'right', overflow: 'hidden' }) || {}"
              >
                <a-button type="primary" :loading="loading" @click="handleSearch()">查询</a-button>
                <a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
              </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
      <a-table 
        ref="table" 
        size="default" 
        rowKey="key" 
        :columns="columns" 
        :scroll="{ x: 1920 }" 
        :data-source="loadData">
        <span slot="serial" slot-scope="text, record, index">
          {{ index + 1 }}
        </span>
        <span slot="status" slot-scope="text, record">
          <template>
            <a-tag color="#82af6f" v-if="record?.status == 1">已审核</a-tag>
            <a-tag color="#D15B47" v-else>待审核</a-tag>
          </template>
        </span>
        <span slot="action" slot-scope="text, record">
          <template> <a-tag color="#428bca" @click="handleDetail(record)">详情</a-tag> </template>
        </span>
      </a-table>
    </a-card>
  </page-header-wrapper>
</template>
  
  <script>
export default {
  name: 'ShopReportGoodsDetails',
  data() {
    return {
      mdl: null,
      visible: false,
      value: '',
      value4: '',
      confirmLoading: false,
      // 高级搜索 展开/关闭
      advanced: false,
      // 查询参数
      queryParam: {},
      // 表头
      columns: [
        {
          title: '订单ID',
          dataIndex: 'id',
          width: 120,
        },
        {
          title: '入库日期',
          dataIndex: 'orderDate',
          width: 120,
        },
        {
          title: '类型',
          dataIndex: 'type',
          width: 120,
        },
        {
          title: '商品名',
          dataIndex: 'goodsName',

          width: 200,
        },
        {
          title: '品牌',
          dataIndex: 'brandName',
          width: 120,
        },
        {
          title: '一级分类',
          dataIndex: 'classfy',
          width: 120,
        },
        {
          title: '二级分类',
          dataIndex: 'classfy2',
          width: 120,
        },
        {
          title: '串码',
          dataIndex: 'code',
          width: 120,
        },
        {
          title: '串码2',
          dataIndex: 'code2',
          width: 120,
        },
        {
          title: '销售日期',
          dataIndex: 'orderDate',
          width: 120,
        },
        {
          title: '成本(元)',
          dataIndex: 'chengben',
          width: 120,
        },
        {
          title: '赠品成本(元)',
          dataIndex: 'zp',
          width: 120,
        },
        {
          title: '售价(元)',
          dataIndex: 'price',
          width: 120,
        },
        {
          title: '零售价(元)',
          dataIndex: 'lsPrice',
          width: 120,
        },
        {
          title: '毛利(元)',
          dataIndex: 'maoli',
          width: 120,
        },
        {
          title: '考核成本(元)',
          dataIndex: 'kaohe',
          width: 120,
        },
        {
          title: '赠品考核成本(元)',
          dataIndex: 'zpkh',
          width: 144,
        },
        {
          title: '考核毛利(元)',
          dataIndex: 'khml',
          width: 120,
        },
        {
          title: '赠品考核成本(元)',
          dataIndex: 'rate',
          width: 144,
        },
        {
          title: '赠品考核成本(元)',
          dataIndex: 'guding',
          width: 144,
        },
        {
          title: '赠品考核成本(元)',
          dataIndex: 'tc',
          width: 144,
        },
        {
          title: '销售员',
          dataIndex: 'user',
          width: 120,
        },
        {
          title: '销售店面',
          dataIndex: 'storeName',
          width: 120,
        },
        {
          title: '供应商',
          dataIndex: 'supplyName',
          width: 120,
        },
        {
          title: '渠道',
          dataIndex: 'channel',
          width: 120,
        },
        {
          title: '会员姓名',
          dataIndex: 'memName',
          width: 120,
        },
        {
          title: '会员电话',
          dataIndex: 'phone',
          width: 120,
        },
        {
          title: '备注',
          width: 120,
          dataIndex: 'memo',
        },
        {
          title: '操作',
          dataIndex: 'action',
          width: '100px',
          fixed: 'right',
          scopedSlots: { customRender: 'action' },
        },
      ],
      loading: false,
      // 加载数据方法 必须为 Promise 对象
      loadData: [
        {
          id: 1,
          orderDate: '2020-09-18',
          type: '售出',
          goodsName: '华为P60 12+256G玫瑰红',
          brandName: '小米',
          classfy: '1',
          classfy2: '2',
          code: '1',
          code: '2',
          chengben: 6898,
          zp: 0,
          price: '6999',
          lsPrice: '6999',
          maoli: '10',
          kaohe: '5000',
          zpkh: '0',
          khml: '1999',
          rate: '0%',
          guding: '100',
          tc: '100',
          supplyName: '测试',
          user: '测试员工',
          storeName: '达臻东街店',
          channel: '无',
          memName: '123',
          phone: '13155829112',
          memo: '暂无',
        },
      ],
    }
  },
  methods: {
    handleSearch() {
      this.loading = true
      setTimeout(() => {
        this.loading = false
      }, 1000)
    },
    handleDetail(record) {
      this.$router.push({ path: `/cashier/profile/index/1699973191890497538` })
    },
  },
}
</script>